<template>
	<cc-noticeBar v-if="noticeList.length" :noticeList="noticeList" colors="olive" @click="clickNotice" />
</template>

<script lang="ts" setup>
import { state,setDiscounts } from '../store/business';
import http from '../vendor/http';
import { ref } from 'vue';
export type Notice = {
	id: number;
	title: string;
};

// 获取会员卡列表
const noticeListInit: Array<Notice> = [];
const noticeList = ref(noticeListInit);
http.fetchGet('getbusDiscountList', { business_id: state.busId }).then((res: any) => {
	if (res.list) {
		noticeList.value = [
			{
				id: res.list[0].id,
				title: '购会员卡,最低享' + res.list[0].discount + '折！'
			}
		];
		
		setDiscounts(res.list)
		
	} else {
		noticeList.value = [];
	}
});



const clickNotice = (item: any) => {
	uni.navigateTo({
		url: '/pages/marketing/paycard'
	});
};
</script>

<style></style>
